<?php 
class ControllerCheckoutPending extends Controller {
	function index() { 
		$address   =& $this->locator->get('address');
        $calculate =& $this->locator->get('calculate');
        $cart      =& $this->locator->get('cart');
        $config    =& $this->locator->get('config');
        $coupon    =& $this->locator->get('coupon');
        $currency  =& $this->locator->get('currency');
        $customer  =& $this->locator->get('customer');
        $database  =& $this->locator->get('database');
        $language  =& $this->locator->get('language');
        $module    =& $this->locator->get('module');
        $order     =& $this->locator->get('order');
        $payment   =& $this->locator->get('payment');
        $request   =& $this->locator->get('request');
        $response  =& $this->locator->get('response');
        $session   =& $this->locator->get('session');
        $shipping  =& $this->locator->get('shipping');
        $tax       =& $this->locator->get('tax');
        $template  =& $this->locator->get('template');
        $url       =& $this->locator->get('url');
    //----check if we need all the above---
		 
    	if (!$customer->isLogged()) {
      		$session->set('redirect',  $url->ssl('checkout_pending'));

	  		$response->redirect($url->ssl('account_login'));
    	}
		
   		$language->load('controller/checkout_pending.php');

    	$template->set('title', $language->get('heading_title')); 
		
    	$view = $this->locator->create('template');

		$view->set('tpl', $template);

    	$view->set('heading_title', $language->get('heading_title'));
//
    	$view->set('text_pending', $language->get('text_pending', $url->href('contact')));

    	$view->set('button_click_to_complete', $language->get('button_click_to_complete'));

    	$view->set('continue', $url->href('home'));
        
        $view->set('text_redirect', $language->get('text_redirect'));

        $view->set('error', @$this->error['message']);
        
        $view->set('message', $session->get('message'));
    
        $session->delete('message');
        
        $session->delete('payment_form_enctype');
        
        $session->delete('confirm_id');
                            
        $view->set('payment_url', $session->get('payment_offsite_url'));
              
        if ($session->get('payment_form_enctype')) {
            $view->set('payment_form_enctype', $session->get('payment_form_enctype'));
        }
        
        $order->set('payment_method', $payment->getTitle($session->get('payment_method')));
        
        $view->set('fields', $session->get('fields'));
        
//
    	$template->set('content', $view->fetch('content/checkout_pending.tpl'));
	
		$template->set($module->fetch());
		
		$response->set($template->fetch('layout.tpl'));
  	}
}
?>
